﻿using System.ComponentModel;
using System.Windows.Forms;
using RedRiver.Framework.XtraCommon.Properties;

namespace RedRiver.Framework.XtraCommon.FormHelper {
    public partial class CommonActionImages : Component {
        public const string ImageActionCancel = "Action_Cancel";
        public const string ImageActionClose = "Action_Close";
        public const string ImageActionDelete = "Action_Delete";
        public const string ImageActionEdit = "Action_Edit";
        public const string ImageActionExit = "Action_Exit";
        public const string ImageActionAudit = "Action_Audit";
        public const string ImageActionExport = "Action_Export";
        public const string ImageActionExportToExcel = "Action_Export_ToExcel";
        public const string ImageActionExportToHtml = "Action_Export_ToHTML";
        public const string ImageActionExportToPdf = "Action_Export_ToPDF";
        public const string ImageActionExportToRtf = "Action_Export_ToRTF";
        public const string ImageActionExportToText = "Action_Export_ToText";
        public const string ImageActionExportToXml = "Action_Export_ToXML";
        public const string ImageActionNavigationHistoryBack = "Action_Navigation_History_Back";
        public const string ImageActionNavigationHistoryForward = "Action_Navigation_History_Forward";
        public const string ImageActionNavigationNextObject = "Action_Navigation_Next_Object";
        public const string ImageActionNavigationPreviousObject = "Action_Navigation_Previous_Object";
        public const string ImageActionNew = "Action_New";
        public const string ImageActionOpenObject = "Action_Open_Object";
        public const string ImageActionPrintingPreview = "Action_Printing_Preview";
        public const string ImageActionPrintingPrint = "Action_Printing_Print";
        public const string ImageActionRefresh = "Action_Refresh";
        public const string ImageActionSave = "Action_Save";

        public const string ImageActionSaveClose = "Action_Save_Close";
        public const string ImageActionSaveNew = "Action_Save_New";
        public const string ImageStateValidationValid = "State_Validation_Valid";
        public const string ImageActionReportShowDesigner = "Report_ShowDesigner";
        /// <summary>
        /// 默认实例
        /// </summary>
        private static readonly CommonActionImages Instance = new CommonActionImages();

        public static int IndexActionCancel;
        public static int IndexActionClose;
        public static int IndexActionDelete;
        public static int IndexActionEdit;
        public static int IndexActionExit;
        public static int IndexActionExport;
        public static int IndexActionExportToExcel;
        public static int IndexActionExportToHtml;
        public static int IndexActionExportToPdf;
        public static int IndexActionExportToRtf;
        public static int IndexActionExportToText;
        public static int IndexActionExportToXml;
        public static int IndexActionNavigationHistoryBack;
        public static int IndexActionNavigationHistoryForward;
        public static int IndexActionNavigationNextObject;
        public static int IndexActionNavigationPreviousObject;
        public static int IndexActionNew;
        public static int IndexActionOpenObject;
        public static int IndexActionPrintingPreview;
        public static int IndexActionPrintingPrint;
        public static int IndexActionRefresh;
        public static int IndexActionSave;
        public static int IndexActionSaveClose;
        public static int IndexActionSaveNew;
        public static int IndexStateValidationValid;
        public static int IndexActionAudit;
        public static int IndexActionReportShowDesigner;


        public CommonActionImages() {
            InitializeComponent();
            InitimageList();
        }

        public CommonActionImages(IContainer container) {
            container.Add(this);
            InitializeComponent();
            InitimageList();
        }

        public static ImageList ImageList {
            get { return Instance._imageList; }
        }

        private void InitimageList() {
            _imageList.Images.Add(ImageActionNew, Resources.Action_New);
            _imageList.Images.Add(ImageActionOpenObject, Resources.Action_Open_Object);
            _imageList.Images.Add(ImageActionEdit, Resources.Action_Edit);
            _imageList.Images.Add(ImageActionDelete, Resources.Action_Delete);
            _imageList.Images.Add(ImageActionSave, Resources.Action_Save);
            _imageList.Images.Add(ImageActionExport, Resources.Action_Export);
            _imageList.Images.Add(ImageActionExportToExcel, Resources.Action_Export_ToExcel);
            _imageList.Images.Add(ImageActionExportToHtml, Resources.Action_Export_ToHTML);
            _imageList.Images.Add(ImageActionExportToPdf, Resources.Action_Export_ToPDF);
            _imageList.Images.Add(ImageActionExportToRtf, Resources.Action_Export_ToRTF);
            _imageList.Images.Add(ImageActionExportToText, Resources.Action_Export_ToText);
            _imageList.Images.Add(ImageActionExportToXml, Resources.Action_Export_ToXML);
            _imageList.Images.Add(ImageActionPrintingPreview, Resources.Action_Printing_Preview);
            _imageList.Images.Add(ImageActionPrintingPrint, Resources.Action_Printing_Print);
            _imageList.Images.Add(ImageActionRefresh, Resources.Action_Refresh);
            _imageList.Images.Add(ImageActionClose, Resources.Action_Close);
            _imageList.Images.Add(ImageActionNavigationPreviousObject, Resources.Action_Navigation_Previous_Object);
            _imageList.Images.Add(ImageActionNavigationHistoryForward, Resources.Action_Navigation_History_Forward);
            _imageList.Images.Add(ImageActionNavigationNextObject, Resources.Action_Navigation_Next_Object);
            _imageList.Images.Add(ImageActionNavigationHistoryBack, Resources.Action_Navigation_History_Back);
            _imageList.Images.Add(ImageActionSaveNew, Resources.Action_Save_New);
            _imageList.Images.Add(ImageActionSaveClose, Resources.Action_Save_Close);
            _imageList.Images.Add(ImageStateValidationValid, Resources.State_Validation_Valid);
            _imageList.Images.Add(ImageActionCancel, Resources.Action_Cancel);
            _imageList.Images.Add(ImageActionExit, Resources.Action_Exit);
            _imageList.Images.Add(ImageActionAudit, Resources.State_Task_Completed);
            _imageList.Images.Add(ImageActionReportShowDesigner, Resources.Action_Report_ShowDesigner);

            IndexActionCancel = _imageList.Images.IndexOfKey(ImageActionCancel);
            IndexActionClose = _imageList.Images.IndexOfKey(ImageActionClose);
            IndexActionDelete = _imageList.Images.IndexOfKey(ImageActionDelete);
            IndexActionEdit = _imageList.Images.IndexOfKey(ImageActionEdit);
            IndexActionExport = _imageList.Images.IndexOfKey(ImageActionExport);
            IndexActionExportToExcel = _imageList.Images.IndexOfKey(ImageActionExportToExcel);
            IndexActionExportToHtml = _imageList.Images.IndexOfKey(ImageActionExportToHtml);
            IndexActionExportToPdf = _imageList.Images.IndexOfKey(ImageActionExportToPdf);
            IndexActionExportToRtf = _imageList.Images.IndexOfKey(ImageActionExportToRtf);
            IndexActionExportToText = _imageList.Images.IndexOfKey(ImageActionExportToText);
            IndexActionExportToXml = _imageList.Images.IndexOfKey(ImageActionExportToXml);
            IndexActionNavigationHistoryBack = _imageList.Images.IndexOfKey(ImageActionNavigationHistoryBack);
            IndexActionNavigationHistoryForward = _imageList.Images.IndexOfKey(ImageActionNavigationHistoryForward);
            IndexActionNavigationNextObject = _imageList.Images.IndexOfKey(ImageActionNavigationNextObject);
            IndexActionNavigationPreviousObject = _imageList.Images.IndexOfKey(ImageActionNavigationPreviousObject);
            IndexActionNew = _imageList.Images.IndexOfKey(ImageActionNew);
            IndexActionOpenObject = _imageList.Images.IndexOfKey(ImageActionOpenObject);
            IndexActionPrintingPreview = _imageList.Images.IndexOfKey(ImageActionPrintingPreview);
            IndexActionPrintingPrint = _imageList.Images.IndexOfKey(ImageActionPrintingPrint);
            IndexActionRefresh = _imageList.Images.IndexOfKey(ImageActionRefresh);
            IndexActionSave = _imageList.Images.IndexOfKey(ImageActionSave);
            IndexActionSaveClose = _imageList.Images.IndexOfKey(ImageActionSaveClose);
            IndexActionSaveNew = _imageList.Images.IndexOfKey(ImageActionSaveNew);
            IndexStateValidationValid = _imageList.Images.IndexOfKey(ImageStateValidationValid);
            IndexActionExit = _imageList.Images.IndexOfKey(ImageActionExit);
            IndexActionAudit = _imageList.Images.IndexOfKey(ImageActionAudit);
            IndexActionReportShowDesigner = _imageList.Images.IndexOfKey(ImageActionReportShowDesigner);
        }

        public static int GetImageIndex(string key) {
            return Instance._imageList.Images.IndexOfKey(key);
        }

        public ImageList Images {
            get { return _imageList; }
        }
    }
}